<template>
  <div id="app">
    {{ name }}
    <button @click="sayHello">点我</button>
    <button @click="getInfo">点我获取数据</button>

    <div>
      <div class="row">
        <div class="col-xs-offset-2 col-xs-8">
          <div class="page-header"><h2>Vue Router Demo</h2></div>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-2 col-xs-offset-2">
          <div class="list-group">
            <!-- Vue中借助router-link标签实现路由的切换 -->
            <router-link class="list-group-item" active-class="active" to="/about">About</router-link>
            <router-link class="list-group-item" active-class="active" to="/home">Home</router-link>
            <router-link class="list-group-item" active-class="active" to="/student">student</router-link>
          </div>
        </div>
        <div class="col-xs-6">
          <div class="panel">
            <div class="panel-body">
              <!-- 指定组件的呈现位置 -->
              <router-view></router-view>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import qqq from './utils/mixin'
import axios from 'axios'

axios.defaults.baseURL = '/api'
export default {
  name: 'App',
  mixins: [qqq],
  components: {
    HelloWorld
  },
  methods: {
    getInfo() {
      axios.get("/rsa/secretKey").then(resp => {
        console.log("resp:", JSON.stringify(resp))
      }, error => {
        console.log("resp:", JSON.stringify(error))
      })
    }
  },
  mounted() {
    console.log("App", this)
  }

}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
